<?php // -*-coding:utf-8; mode:php-mode;-*-
use framework\mvc\view\smarty;
use framework\data\pdo;
session_start();

use framework\mvc\dispatcher\HTTPRequestDispatcher;
use framework\core\Context;
use framework\manager\PDOManager;

include_once("../lib/raftphp/setup.php");

Context::setRootPath(realpath('..'));
Context::initialize();

$smartyConfig = new smarty\SmartyConfiguration();
$smartyConfig->smartyPath = "../lib/smarty";
$smartyConfig->cacheDir = "../template/cache";
$smartyConfig->compileDir = "../template/compile";
$smartyConfig->templateDir = "../template/template";
$smartyConfig->configDir = "../template/config";

smarty\SmartyView::setSmartyConfiguration($smartyConfig);

$pdoConfig = new pdo\PDOConfiguration();
$pdoConfig->protocol = DB_PROTOCOL;
$pdoConfig->host = DB_HOST;
$pdoConfig->port = DB_PORT;
$pdoConfig->user = DB_USER;
$pdoConfig->pass = DB_PASS;
$pdoConfig->dbname = DB_LIBR;

pdo\PDOManager::addConfigration("default", $pdoConfig);

class MyHTTPRequestDispatcher extends HTTPRequestDispatcher
{
	public function getCtrlClassName()
	{
		return parent::getCtrlClassName() . "Ctrl";
	}
}

$dispatcher = new \MyHTTPRequestDispatcher();
$dispatcher->dispatch();